/* 聊天室容器 */
.chat-container {
  height: 80vh;
  max-width: 1200px;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 聊天头部 */
.chat-header {
  background: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: none;
}

.chat-title h1 {
  margin: 0;
  font-size: 1.2em;
  color: #374151;
  font-weight: 500;
  text-align: center;
}

.chat-title p {
  display: none;
}

.chat-status {
  display: none;
}

/* 消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
}

/* 消息样式 */
.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: slideIn 0.3s ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.bot {
  align-self: flex-start;
}

.message.system {
  align-self: center;
  max-width: 60%;
}

/* 消息头像 */
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

/* 消息内容 */
.message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  position: relative;
}

.message.user .message-content {
  background: #3b82f6;
  color: white;
  border: 1px solid #3b82f6;
}

.message.system .message-content {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

/* 消息文本 */
.message-text p {
  margin: 0;
  line-height: 1.5;
  word-wrap: break-word;
}

.message-text pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0 0 0;
  white-space: pre-wrap;
}

/* 消息时间 */
.message-time {
  font-size: 0.75em;
  opacity: 0.7;
  margin-top: 5px;
  text-align: right;
}

.message.user .message-time {
  text-align: left;
}

/* 打字指示器 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 快速回复 */
.quick-replies {
  padding: 15px 20px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.quick-reply-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9em;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-reply-btn:hover:not(:disabled) {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quick-reply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 输入区域 */
.chat-input {
  background: #ffffff;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.input-container textarea {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.input-container textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.input-container textarea:disabled {
  background: #f9fafb;
  cursor: not-allowed;
}

/* 发送按钮 */
.send-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover:not(:disabled) {
  background: #2563eb;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #9ca3af;
}

/* 加载动画 */
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 输入提示 */
.input-tips {
  margin-top: 10px;
  text-align: center;
}

.input-tips p {
  margin: 0;
  font-size: 0.85em;
  color: #6b7280;
}

/* 动画 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.quick-replies::-webkit-scrollbar {
  height: 4px;
}

.quick-replies::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.quick-replies::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

/* 文件上传相关样式 */
.uploaded-files {
  max-width: 1200px;
  margin: 0 auto 20px auto;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
}

.uploaded-files-header {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
}

.uploaded-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.file-icon {
  font-size: 16px;
}

.file-name {
  font-size: 14px;
  color: #495057;
  font-weight: 500;
}

.file-size {
  font-size: 12px;
  color: #6c757d;
}

.remove-file-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.remove-file-btn:hover {
  background-color: #f8d7da;
}

/* 更新输入区域样式 */
.input-container {
  max-width: 1200px;
  margin: 0 auto;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-row textarea {
  flex: 5;
  min-height: 40px;
  max-height: 120px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  resize: none;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.3s ease;
  min-width: 600px;
}

.input-row textarea:focus {
  border-color: #4CAF50;
}

.input-row textarea:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.input-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.file-btn {
  width: 40px;
  height: 40px;
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-btn:hover:not(:disabled) {
  background: #e9ecef;
  border-color: #4CAF50;
}

.file-btn:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-header {
    padding: 15px 20px;
  }
  
  .chat-title h1 {
    font-size: 1.5em;
  }
  
  .chat-messages {
    padding: 15px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .quick-replies {
    padding: 10px 15px;
  }
  
  .chat-input {
    padding: 15px;
  }
  
  .input-container {
    gap: 8px;
  }
  
  .send-btn {
    padding: 10px 20px;
    min-width: 70px;
  }
  
  .uploaded-files {
    margin: 0 auto 15px auto;
    padding: 12px;
  }
  
  .input-buttons {
    gap: 6px;
  }
  
  .file-btn {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 10px 15px;
  }
  
  .chat-title h1 {
    font-size: 1.3em;
  }
  
  .chat-title p {
    font-size: 0.8em;
  }
  
  .message-avatar {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
  
  .message-content {
    padding: 12px 16px;
  }
  
  .quick-reply-btn {
    padding: 6px 12px;
    font-size: 0.8em;
  }
  
  .input-container textarea {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .send-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* 文档预览样式 */
.document-preview {
  background: #1f2937;
  color: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0 0 0;
  white-space: pre-wrap;
  border: 1px solid #374151;
}

/* 焦点样式 */
*:focus {
  outline: none;
}

/* 按钮点击效果 */
.send-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quick-reply-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} 

/* 下载区域 */
.download-section {
  text-align: center;
}

.download-section p {
  margin-bottom: 15px;
  color: #666;
  font-weight: 500;
}

.download-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.download-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.download-btn.markdown {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.download-btn.docx {
  background: linear-gradient(135deg, #2E8B57 0%, #228B22 100%);
  color: white;
}

.download-btn.html {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.download-btn.text {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.download-btn:active {
  transform: translateY(0);
}

/* 响应式下载按钮 */
@media (max-width: 768px) {
  .download-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .download-btn {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
}